<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"%>
<%@ page import="org.apache.shiro.authc.ExcessiveAttemptsException"%>
<%@ page import="org.apache.shiro.authc.IncorrectCredentialsException"%>


<%@ taglib prefix="sitemesh" uri="http://www.opensymphony.com/sitemesh/decorator"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<!DOCTYPE html>
<html lang="en">
<head>
<title>深投发展物业管理系统</title>
<%-- <!-- BEGIN PAGE LEVEL STYLES -->
<link href="${ctx}/assets/metronic_v3.2.0/admin/pages/css/login.css" rel="stylesheet" type="text/css"/>
<!-- END PAGE LEVEL SCRIPTS -->
<!-- BEGIN PAGE LEVEL JS -->
<script src="${ctx}/assets/metronic_v3.2.0/admin/pages/scripts/login.js" type="text/javascript"></script>
<!-- END PAGE LEVEL PLUGINS --> --%>
<style type="text/css">
html {
	background-color: #E9EEF0
}
.wrapper {
	margin: 140px auto;
	width: 884px;
}
.loginBox {
	background-color: #FEFEFE;
	border: 1px solid #BfD6E1;
	border-radius: 5px;
	color: #444;
	font: 14px 'Microsoft YaHei','微软雅黑';
	margin: 0 auto;
	width: 388px
}
.loginBox .loginBoxCenter {
	border-bottom: 1px solid #DDE0E8;
	padding: 5px 24px;
}
.loginBox .loginBoxCenter p {
	margin-bottom: 10px
}
.loginBox .loginBoxButtons {
	background-color: #F0F4F6;
	border-top: 1px solid #FFF;
	border-bottom-left-radius: 5px;
	border-bottom-right-radius: 5px;
	line-height: 28px;
	overflow: hidden;
	padding: 20px 24px;
	vertical-align: center;
}
.loginBox .loginBoxTitle {
	background-color: #F0F4F6;
	border-top: 1px solid #FFF;
	border-top-left-radius: 5px;
	border-top-right-radius: 5px;
	line-height: 28px;
	overflow: hidden;
	padding: 10px 24px;
	vertical-align: center;
}
.loginBox .loginBoxTitle h3{
 margin: 10px 0px;
 color: #666;
}
.loginBox .loginInput {
	border: 1px solid #D2D9dC;
	border-radius: 2px;
	color: #444;
	font: 12px 'Microsoft YaHei','微软雅黑';
	padding: 8px 14px;
	margin-bottom: 8px;
	width: 310px;
}
.loginBox .loginInput:FOCUS {
	border: 1px solid #B7D4EA;
	box-shadow: 0 0 8px #B7D4EA;
}
.loginBox .loginBtn {
	background:#B5DEF2;
	background-image: -moz-linear-gradient(to bottom, #B5DEF2, #85CFEE);
	background: -webkit-gradient(linear, left top, left bottom, from(#B5DEF2), to(#85CFEE));
	border: 1px solid #98CCE7;
	border-radius: 20px;
	box-shadow:inset rgba(255,255,255,0.6) 0 1px 1px, rgba(0,0,0,0.1) 0 1px 1px;
	color: #FFF;
	cursor: pointer;
	float: right;
	font: bold 13px Arial;
	padding: 5px 14px;
}
.loginBox .loginBtn:HOVER {
	background:#B5DEF2;
	background-image: -moz-linear-gradient(to top, #B5DEF2, #85CFEE);
	background: -webkit-gradient(linear, left top, left bottom, from(#B5DEF2), to(#85CFEE));
}
.loginBox a.forgetLink {
	color: #ABABAB;
	cursor: pointer;
	float: right;
	font: 11px/20px Arial;
	text-decoration: none;
	vertical-align: middle;
}
.loginBox a.forgetLink:HOVER {
	text-decoration: underline;
}
.loginBox input#rememberMe {
	vertical-align: middle;
}
.loginBox label[for="rememberMe"] {
	font: 11px Arial;
}
.loginInput{
	background-color: white !important;
}
.error{
	color: red;
}
</style>
</head>
<body class="login">


<!-- BEGIN LOGIN -->
		
<div class="wrapper">
	<form  action="${ctx}/login" method="post" id="loginForm" name = "loginForm" >
		<div class="loginBox">
			<div class="loginBoxTitle">
				<h3>深投发展物业管理系统</h3>
			</div>
			<div class="loginBoxCenter">
				<%
			String error = (String) request.getAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME);
			String exceptionMsg = (String) request.getAttribute("exception");
			if (error != null) {
				String msg = "";
				
				if(error.contains("IncorrectCredentialsException"))
					msg = "用户名或密码错误";
				else if(error.contains("LockedAccountException"))
					msg = "用户已经被禁用";
				else if(error.contains("CaptchaException"))
					msg = "验证码错误";
				else
					msg = exceptionMsg ;
		%>
		<div class="error">
			登录失败：<%= msg %>
		</div>
		<%
			}
		%>
				<p><label for="username">用户名：</label></p>
				<p><input type="text" id="username" name="username" class="loginInput" autofocus="autofocus" required="required" autocomplete="off" placeholder="请输入用户名" value="" /></p>
				<p><label for="password">密码：</label><!-- <a class="forgetLink" href="#">忘记密码?</a> --></p>
				<p><input type="password" id="password" name="password" class="loginInput" required="required" placeholder="请输入密码" value="" /></p>
			</div>
			<div class="loginBoxButtons">
				<input id="rememberMe" type="checkbox" name="rememberMe" />
				<label for="rememberMe">记住登录状态</label>
				<button type="submit"  class="loginBtn">登录</button>
			</div>
		</div>
	</form>
</div>
	
<!-- END COPYRIGHT -->
<script>
/* 	jQuery(document).ready(function() {
		Login.init();
	}); */
</script>
</body>
</html>
